package edu.ycxy.poetry.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.ycxy.poetry.entity.BookLei;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author @xin
 * @createDate 2022/3/15
 * @Description
 */
@Repository
public interface BookLeiMapper extends BaseMapper<BookLei> {

    //根据vab_dj_list中的id 对应 vab_dj_info 中的 aid ,查询古籍的主标题,如果查询结果为空,则说明没有主标题,直接在 vab_dj_info中查询次标题
    @Select("SELECT * FROM `vab_booklei` where id in (select DISTINCT zjtype from vab_dj_info where aid=#{aid} order by zjtype) order by pid")
    List<BookLei> selectListToInfo(Integer aid);
}
